import Vue from 'vue'
import Router from 'vue-router'
import Login from "../views/Login"
import Register from "../views/Register"
import Index from "../views/Index"
import Login_admin from "../views/Login_admin";

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/index',
      name: 'Index',
      component: ()=>import('../views/Index'),
      children:[
        {//管理员主页路由
          path:'admin',
          name:'Admin',
          component:()=>import('../views/admin/Index'),
          redirect:'/index/admin/management',
          children:[
            { //档案管理
              path:'management',
              name:'Management',
              component:()=>import('../views/admin/management/Index'),
              redirect:'/index/admin/management/unreviewed',
			        children: [
                { //未审核档案管理
                  path:'unreviewed',
                  name:'Unreviewed',
                  component:()=>import('../views/admin/management/Unreviewed')
                },
                { //合格档案管理
                  path:'passed',
                  name:'Passed',
                  component:()=>import('../views/admin/management/Passed')
                },
                { //不合格档案管理
                  path:'unqualified',
                  name:'Unqualified',
                  component:()=>import('../views/admin/management/Unqualified')
                },
                { //已注销档案管理
                  path:'cancelled',
                  name:'Cancelled',
                  component:()=>import('../views/admin/management/Cancelled')
                }
              ]
            },
            { // 补助发放管理
              path:'subsidy',
              name:'Subsidy',
              component:()=>import('../views/admin/subsidy/Index')
            },
            { //资金管理
              path:'fundManagement',
              name:'FundManagement',
              component:()=>import('../views/admin/fundManagement/Index')
            },
            {//数据信息统计
              path:'statistics',
              name:'Statistics',
              component:()=>import('../views/admin/statistics/Index'),
              children: [
                { //职工收入统计组件
                  path:'staIncome',
                  name:'StaIncome',
                  component:()=>import('../views/admin/statistics/StaIncome')
                },
                { //补助发放统计组件
                  path:'staRelief',
                  name:'StaRelief',
                  component:()=>import('../views/admin/statistics/StaRelief')
                },
              ]
            },
            {//政策文件管理
              path:'policy',
              name:'Policy',
              component:()=>import('../views/admin/policy/Index')
            },
          ]
        },
        { //用户主页路由
          path:'worker',
          name:'Worker',
          component:()=>import('../views/worker/Index'),
          redirect:'/index/worker/record',
          children:[
            { //我的档案
              path:'record',
              name:'Record',
              component:()=>import('../views/worker/record/Index'),
              children:[
                { //申请修改
                  path:'recordApply',
                  name:'RecordApply',
                  component:()=>import('../views/worker/record/RecordApply')
                },
                { //我的档案子组件
                  path:'myRecord',
                  name:'MyRecord',
                  component:()=>import('../views/worker/record/MyRecord')
                },
                {
                  path:'createRecord',
                  name:'CreateRecord',
                  component:()=>import('../views/worker/record/CreateRecord')
                }
              ]
            },
            { //文件下载
              path:'file_download',
              name:'FileDownload',
              component:()=>import('../views/worker/FileDownload')
            },
            { // 修改密码
              path:'password_upt',
              name:'PasswordUpt',
              component:()=>import('../views/worker/PasswordUpt')
            },
            { //补助查询
              path:'subsidy_Query',
              name:'SubsidyQuery',
              component:()=>import('../views/worker/SubsidyQuery')
            },
            { //我的消息
              path:'message',
              name:'Message',
              component:()=>import('../views/worker/Message')
            }
          ]
        },
      ]
    },
    {
      path: '/login',
      name: 'Login',
      component: ()=>import('../views/Login')
    },
    {
      path: '/register',
      name: 'Register',
      component: ()=>import('../views/Register')
    },
    {
      path: '/login_admin',
      name: 'Login_admin',
      component: ()=>import('../views/Login_admin')
    }
  ]
})
